package com.demo.client;

import com.extjs.gxt.ui.client.data.BaseModel;

public class Stock extends BaseModel {
	public Stock(String symbol) {
		set("Symbol", symbol);
		set("Company", "-");
		set("Change", 0.00);
		set("PercentChange", 0.00);
		set("LastPrice",0.00);
	}

	public String getCompany() {
		return (String) get("Company");
	}

	public String getSymbol() {
		return (String) get("Symbol");
	}

	public double getLastPrice() {
		Double lastPrice = Double.parseDouble((String) get("LastPrice"));
		return lastPrice.doubleValue();
	}

	public double getChange() {
		Double change = Double.parseDouble((String) get("Change"));
		return change.doubleValue();
	}

	public double getPercentChange() {
		Double percentChange = Double.parseDouble((String) get("PercentChange"));
		return percentChange.doubleValue();
	}

	public String toString() {
		return getSymbol();
	}
}
